package wox.lonice.enums.leguan;

/**
 * 领域
 */
public enum FieldEnum {
    parenting(0, "育儿"),
    education(1, "教育"),
    life(2, "生活"),
    cate(3, "美食"),
    emotion(4, "情感"),
    travel(5, "旅行"),
    wechat(6, "职场"),
    workplace(7, "时政"),
    finance(8, "财经"),
    military(9, "军事"),
    culture(10, "文化"),
    history(11, "历史"),
    technology(12, "科技"),
    digital(13, "数码"),
    movies(14, "影视"),
    constellation(15, "星座"),
    game(16, "游戏"),
    comic(17, "动漫"),
    mengChong(18, "萌宠"),
    entertainment(19, "娱乐"),
    funny(20, "搞笑"),
    fashion(21, "时尚"),
    sports(22, "体育"),
    healthy(23, "健康"),
    houseProperty(24, "房产"),
    automobile(25, "汽车"),
    media(26, "传媒"),
    threeRural(27, "三农"),
    comprehensive(28, "综合"),
    ;

    private final int value;

    private final String name;

    FieldEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }

    /**
     * Return the integer value of this status code.
     */
    public Integer value() {
        return this.value;
    }

    /**
     * Return the name of this status code.
     */
    public String getName() {
        return this.name;
    }

    /**
     * Return a string representation of this status code.
     */
    @Override
    public String toString() {
        return Integer.toString(this.value);
    }

    /**
     *
     * @param name
     * @return
     */
    public static FieldEnum nameOf(String name) {
        for (FieldEnum item : values()) {
            if (item.name.equals(name)) {
                return item;
            }
        }
        throw new IllegalArgumentException("No matching constant for [" + name + "]");
    }

    /**
     *
     * @param code
     * @return
     */
    public static FieldEnum valueOf(int code) {
        for (FieldEnum item : values()) {
            if (item.value == code) {
                return item;
            }
        }
        throw new IllegalArgumentException("No matching constant for [" + code + "]");
    }
}
